import $service from '../../../../service.js';
var hospital_id = "1";
var that;
var this_;
var log_id;
Page({
    data:{
       dataMap:{}
       
    },
    onLoad(e){
        log_id = e.log_id
    },
    onShow(){
        that = this.data;
        this.publicUtil_getInquiryLogDetails()
    },
    //数据
    publicUtil_getInquiryLogDetails:function(){
        var this_=this
        setTimeout(() => {
            this_.publicUtil_getInquiryLogDetails();
        }, 10000);
        var jsonData ={
            "is_receive":"1",
            "log_id" : log_id
        }
        var jsonAjax = {
            "url": "publicUtil_getInquiryLogDetails.do",
            "jsonData": jsonData,
        }
        $service.getAjaxData(jsonAjax, this.publicUtil_getInquiryLogDetails_back);
    },
    //回调
    publicUtil_getInquiryLogDetails_back: function(jsonBack){
         var data=$service.strToJson(jsonBack.data).data;
         data.inquiryMap.lrsj2 = $service.nothinglrsj(data.inquiryMap.lrsj)
         
         if (!$service.isUndefinedAndEmpty(data.inquiryMap.lof_diagnosis)) {
             var lof_diagnosis = '';
             var lof_diagnosis2 = '';
             var numC =0
             var lofdiagnosislist = data.inquiryMap.lof_diagnosis.split(",")
             for (var i = 0; i < lofdiagnosislist.length; i++) {
                 var index = lofdiagnosislist[i].indexOf('自定义诊断');
                 if (index > -1) {
                     lof_diagnosis2 += lofdiagnosislist[i] + ",";
                 } else {
                     numC++
                     lof_diagnosis += "(" + numC + ")" + lofdiagnosislist[i] + ",";
                 }
             }
             data.inquiryMap.diagnosisMap = lof_diagnosis + lof_diagnosis2;
             data.inquiryMap.diagnosisMap = data.inquiryMap.diagnosisMap.substring(0, data.inquiryMap.diagnosisMap.length - 1);
         } else {
             data.inquiryMap.diagnosisMap =''
         }
         this.setData({
             dataMap : data
         })
    },
    gotodetalis(e){
        var index = e.currentTarget.dataset.index;
        var num = e.currentTarget.dataset.num;
        if(index == 1){//检验检查
            $service.openPage('../index_inspection_inspection/index_inspection_inspection?checklist_id=' + this.data.dataMap.checklistList[num].checklist_id)
        }else if(index == 2){//健康指导
            $service.openPage('../index_health_guidance/index_health_guidance?guidance_id=' + this.data.dataMap.guidanceList[num].guidance_id)
        }else if(index == 3){//住院建议
            $service.openPage('../index_recommendations_hospitalization/index_recommendations_hospitalization?hospitalization_id=' + this.data.dataMap.hospitalizationList[num].hospitalization_id)
        }else if(index == 4){//处方
            $service.openPage('../index_prescription_details/index_prescription_details?prescription_id=' + this.data.dataMap.prescriptionList[num].prescription_id)
        }else if(index == 5){//查看图片
            $service.openPage('../index_picturelist/index_picturelist?prescription_id=' + this.data.dataMap.log_id)
        }
    }
})